#include <maya/MPlug.h>
#include <maya/MObjectArray.h>

class VUtil {

public:
	
	static bool IsMesh(MObject& object);
	static bool IsTransform(MObject& object);
	static bool IsTextureSupported(MObject& object);
	static bool IsMaterialSupported(MObject& object);

	static bool GetMeshByName(MString& name, MObject& targetObject);
	static bool GetMaterialByName(MString& name, MObject& materialObject);
	static bool GetProceduralByName(MString& name, MObject& proceduralTextureObject);
	static bool GetSurfaceTextureByName(MString& name, MObject& surfaceTextureObject);	
	
	static bool GetMeshTransform(MObject& object, MObject& transform);
	static bool GetMeshTriangleCount(MObject& object, u_int& triangleCount);
	static bool GetMeshMaterials(MObject& object, MObjectArray& materials);
	static bool GetMeshMaterial(MObject& object, u_int index, MObject& material);
	static bool GetMeshVertexFormat(MObject& object, u_int& vertexFormat);
	
	static bool GetMeshInstanceProcedrual(MObject& targetObject, MString& channel, MObject& proceduralTexture);
	
	static bool GetMaterialDecal(MObject& material, MObject& textureObject);
	static bool GetMaterialNormal(MObject& material, MObject& textureObject);
	static bool GetMaterialSpecular(MObject& material, MObject& textureObject);

	static bool GetTextureFilename(MObject& texture, MString& filename);
	static bool GetTransformMesh(MObject& object, MObject& mesh);

	static bool GetObjectName(MObject& object, MString& objectName);
	static bool GetInstanceMeshParents(MObject& meshInstance, MObjectArray& meshInstanceParents);
	static bool GetObjectAttribute(MObject& root, MString& attributeName, MPlug& attributePlug);
	static bool TraverseDAGForType(MObject& root, MFn::Type type, MObject& node);
};